home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Creative Review 28
/
Creative-Review-CD-ROM-28.iso
/
pc
/
kungfu
/
assets
/
game.dir
/
00062_Script_time class
< prev
next >
Wrap
Text File
|
1997-08-08
|
3KB
|
110 lines
-- time class
-- -----------------------------------------------------------------------------
property taskq
-- =============================================================================
-- new method
-- -----------------------------------------------------------------------------
on new me
mInit me
return me
end new
-- =============================================================================
-- minit method
-- -----------------------------------------------------------------------------
on minit me
-- put "minit time"
set taskq = [:]
sort taskq
end minit
-- =============================================================================
-- mdispose method
-- -----------------------------------------------------------------------------
on mdispose me
put "mdispose time"
set taskq = 0
end mdispose
-- =============================================================================
-- mDoTask method
-- -----------------------------------------------------------------------------
on mDoTask me
if count (taskq) then
if the timer >= getPropAt (taskq, 1) then
set tasktime = getPropAt (taskq, 1)
set object = getat (taskq,1)
deleteAt taskq, 1
set next = mDoTask(object)
if next then mAddTask (me, object, tasktime + next)
mDoTask me
end if
end if
end mDotask
-- =============================================================================
-- mAddTask method
-- -----------------------------------------------------------------------------
on mAddTask me, who, when
if objectp(who) and integerP(when) then
addProp taskq, when, who
else put "incorrect task: " , who, when
end mAddTask
-- =============================================================================
-- mDeleteTasks method
-- -----------------------------------------------------------------------------
on mDeleteTasks me, who
repeat with taskindex = 1 to count (taskq)
if getat(taskq, taskindex) = who then deleteat(taskq, taskindex)
end repeat
end mDeleteTasks
-- =============================================================================
-- mEmpty method
-- -----------------------------------------------------------------------------
on mEmpty me
set taskq = [:]
sort taskq
end mEmpty
-- =============================================================================
-- mShow method
-- -----------------------------------------------------------------------------
on mShow me
put "in mShow time"
repeat with index = 1 to count ( taskq )
set time = getpropat ( taskq, index )
set task = getat ( taskq, index )
put ( pad ( 0, 50 , time, task ) )
end repeat
put "out mShow time"
end mShow